home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2687 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  733 b 

  1. Path: colossus.holonet.net!russell
  2. From: russell@news.mdli.com (Russell Blackadar)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: overloading []
  5. Date: 19 Jan 1996 03:49:38 GMT
  6. Organization: HoloNet National Internet Access System: 510-704-1058/modem
  7. Message-ID: <4dn4ci$lor@colossus.holonet.net>
  8. References: <4dgjbl$6i3@news1.goodnet.com> <4dmh30$p7s@fw.bluestone.com>
  9. NNTP-Posting-Host: jubal.mdli.com
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. isaac reitman (isaac) wrote:
  13. : You should do it in the follow way:
  14. : *f[1] = 10;
  15.  
  16. Oops, no.   *f is the object whose operator[] you want to call.
  17. Since * has lower precedence, you need to have parentheses, as
  18. others have already pointed out:
  19.  
  20.   (*f)[1] = 10;
  21.  
  22. --
  23. Russell Blackadar,   russell@mdli.com
  24.